<template>
  <div class="container">
    <SilderNavs />
    <TopNavs />
    <div class="content">
      <RouterView />
    </div>
  </div>
</template>

<script setup>
// import { onMounted } from 'vue'
import SilderNavs from '@/components/SliderNavs/index.vue'
import TopNavs from '@/components/TopNavs/index.vue'
import { useRouter } from 'vue-router'
// import { hrDynamicRoute, userDynamicRoute } from '@/router/dynamicRoute.js'
const router = useRouter()

// onMounted(() => {
//   const userStr = localStorage.getItem('user')
//   const user = userStr ? JSON.parse(userStr) : null

//   if (user && user.userRole === 'hr') {
//     // 遍历 hrDynamicRoute 数组，逐个添加路由
//     hrDynamicRoute.forEach(route => {
//       router.addRoute('layout', route)
//     })
//   } else if (user && user.userRole === 'user') {
//     // 遍历 userDynamicRoute 数组，逐个添加路由
//     userDynamicRoute.forEach(route => {
//       router.addRoute('layout', route)
//     })
//   }
// })
</script>

<style lang="scss" scoped>
.container {
  .content {
    overflow-y: auto;
    height: calc(100vh - 70px);
    margin: 60px 10px 10px 220px;
    background-color: #e8e8e8;
  }
}
</style>
